package com.lic.system.controller;

import com.lic.system.common.Result;
import com.lic.system.pojo.User;
import com.lic.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Hewb
 * @ClassName: userController
 * @Description: TODO
 * @date: 2020/7/11 9:32
 * @since JDK 1.8
 */
@RestController
@RequestMapping("user")
public class userController {

    @Autowired
    UserService userService;

    @PostMapping("createUser")
    public Result insertUser(@RequestBody User user) {
        try{
            int i = userService.insertUser(user);
            return Result.ok("新增用户成功");
        }catch (Exception e){
            return  Result.error(e.getMessage());
        }

    }

}
